package com.learn.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

/**
 * @author chenxin
 * @time 2017-02-15-09:00
 */
public class TargetProxy implements InvocationHandler{
    private Object subject;

    TargetProxy(Object subject){
        this.subject = subject;
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("proxy invoke");
        return method.invoke(subject, args);
    }
}
